<?php
/**
  * 菜单模型
  */
class NodeModel extends CommonModel
{
   	// 验证设置
   	protected $_validate	 =	 array(
		array('title','require','菜单中文语言名称必填！',self::MODEL_BOTH),
		array('title','','菜单中文语言已经存在',0,'unique',1)
		);

   	protected $_auto=array(
		array('status','callbackStatus',self::MODEL_UPDATE,'callback'),
		array('is_show','callbackIsShow',self::MODEL_BOTH,'callback')
		);

	protected function callbackIsShow()
	{
	  if(isset($_POST['is_show']))
	  {
	  	return 1;
	  }else{return 0;}
	}   	

	/**
	  * 获取所有菜单
	  * @access public
	  * @return array
	  */
	public function getAllNode()
	{
		$data=array();
		$temp=$this->where($where)->order('sort_order ASC')->select();
		foreach($temp as $v)
		{
			$data[$v['id']]=$v;
		}
		return $data;
	}   

}
?>